#include <iostream>
#include <functional>

using std::cout;
using std::endl;
using std::function;

void test()
{
    int num = 10;
    int age = 20;
    //lambda表达式的函数形态:void(int)
    /* auto f = [&age, num](int value){ */
    function<void(int)> f = [&age, num](int value){
        ++age;
        ++value;
        cout << "age = " << age << endl;
        cout << "value = " << value << endl;
        cout << "num = " << num << endl;
    };

    f(100);
    cout << endl << endl << "+++++++++++++" << endl;
    f(200);

}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

